<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <title>配费详情</title>
</head>
<body>
<div class="table-responsive">
    <table class="table table-striped table-bordered table-hover">
        <thead>
        <th>
        <td>配送员名称</td>
        <td>配送员工号</td>
        <td>统计月份</td>
        <td>供应商名称</td>
        <td>计费类型</td>
        <td>首件单量</td>
        <td>拖件单量</td>
        <td>首件配费</td>
        <td>拖件配费</td>
        <td>商家配费</td>
        </th>
        </thead>
        <tbody>
        <c:forEach items="${salaryDetails}" var="data">
            <tr>
                <td></td>
                <td>${data.userName}</td>
                <td>${data.userCode}</td>
                <td>${data.salaryMonth}</td>
                <td>${data.supplierName}</td>
                <td><c:choose>
                    <c:when test="${data.calculateType ==0}">按件计费
                    </c:when>
                    <c:when test="${data.calculateType ==1}">按重计费
                    </c:when>
                    <c:when test="${data.calculateType ==2}">按件按重混合规则
                    </c:when>
                </c:choose>
                </td>
                <td>${data.majorCount}</td>
                <td>${data.minorCount}</td>
                <td>${data.majorFee}</td>
                <td>${data.minorFee}</td>
                <td>${data.totalFee}</td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <from>
        <input type="hidden" id="userCode" name = "userCode" value="${userCode}"/>
        <input type="hidden" id ="salaryMonth" name = "salaryMonth" value="${salaryMonth}"/>
    </from>
    <input class="btn btn-sm btn-primary" type="submit"  onclick="exportDatas()" value="导出" >
</div>
<script>
    function exportDatas() {
        var params = {
            url: "report/mansalary/exportDetail",
            type: "POST",
        };
        var exportForm = $("<form>");
        $("<input type='hidden' name='userCode' value='${userCode}'/>").appendTo(exportForm);
        $("<input type='hidden' name='salaryMonth' value='${salaryMonth}'/>").appendTo(exportForm);
        $(exportForm).css("display", "none");
        $(exportForm).attr('target', 'targetFrame');
        $(exportForm).attr('method', params.type);
        $(exportForm).attr('action', params.url);
        exportForm = exportForm.appendTo($("body"));
        exportForm.submit();
        exportForm.remove();
    }
</script>
</body>
</html>